#ifndef MLPARAMETERS
#define MLPARAMETERS


#include <string>
#include <opencv/ml.h>
#include "ParamGrid.h"
#include <vector>



namespace mle
{
	enum MLAlgorithm
	{
		DECISION_TREE,
		GRADIENT_BOOSTED_TREES, 
		SUPPORT_VECTOR_MACHINE, 
		RANDOM_TREES,
        EXTREMELY_RANDOMIZED_TREES
	};
    const int algorithmCount = 5;
	const std::string algorithmName[algorithmCount] =
	{
		"decision_tree",
		"gradient_boosted_trees", 
		"support_vector_machine", 
		"random_trees",
        "extremely_randomized_trees"
	};



	class StatModelParams
	{
	public:
		StatModelParams(const std::string& filename);
		~StatModelParams();
		static void LoadPatterns(const std::string& path);
		void Load(const std::string& filename);

		operator CvDTreeParams() const;
		operator CvGBTreesParams() const;
		operator CvRTParams() const;
		operator CvSVMParams() const;


		void InitVaryingByGrid();
		bool VaryByGrid();
		void SaveGridValues();
		void SetSavedGridValues();
		void PrintGridValues(std::ostream& stream);
		
		bool isCVParams() const;
		int Algorithm() const;
		int CVFolds() const;

	private:

		void ClearCV();

		int algorithm;
		CvDTreeParams DTree;
		CvGBTreesParams GBTrees;	
		CvRTParams RTrees;
		CvSVMParams SVM;

		bool CVflag;
		int cvFolds;
		std::vector<ParamGrid*> grids;
	};

}



#endif //MLPARAMETERS
